#include "conf.h"

int *video_quality = &conf.video_quality;
int *video_mode    = &conf.video_mode;

long def_table1[9]={0x2000,0x38D,0x788,0x5800,0x9C5,0x14B8,0x10000,0x1C6A,0x3C45};
long def_table2[9]={0x1CCD,-0x2E1,-0x579,0x4F33,-0x7EB,-0xF0C,0xE666,-0x170A,-0x2BC6};

long table1[9], table2[9];

void change_video_tables(int a, int b){
 int i;
 for (i=0;i<9;i++) {table1[i]=(def_table1[i]*a)/b; table2[i]=(def_table2[i]*a)/b;}
}

long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};

void __attribute__((naked,noinline)) movie_record_task(){
 asm volatile(
                "STMFD   SP!, {R4,LR}\n"
                "SUB     SP, SP, #4\n"
                "MOV     R4, SP\n"
                "B       loc_FFEE679C\n"
"loc_FFEE66F8:\n"
                "LDR     R3, =0x9BAE0\n"
                "LDR     R2, [R3]\n"
                "CMP     R2, #0\n"
                "BNE     loc_FFEE6788\n"
                "SUB     R3, R12, #2\n"
                "CMP     R3, #9\n"
                "LDRLS   PC, [PC,R3,LSL#2]\n"
                "B       loc_FFEE6788\n"
                ".long loc_FFEE6748\n"
                ".long loc_FFEE6760\n"
                ".long loc_FFEE6768\n"
                ".long loc_FFEE6770\n"
                ".long loc_FFEE6750\n"
                ".long loc_FFEE6778\n"
                ".long loc_FFEE6758\n"
                ".long loc_FFEE6788\n"
                ".long loc_FFEE6780\n"
                ".long loc_FFEE6740\n"
"loc_FFEE6740:\n"

                "BL      sub_FFEE6838\n"
                "B       loc_FFEE6784\n"
"loc_FFEE6748:\n"

                "BL      unlock_optical_zoom\n"
                "BL      sub_FFEE69EC\n"
                "B       loc_FFEE6784\n"
"loc_FFEE6750:\n"

                "BL      sub_FFEE6E70_my\n"		//------>
                "B       loc_FFEE6784\n"
"loc_FFEE6758:\n"

                "BL      sub_FFEE72B8\n"
                "B       loc_FFEE6784\n"
"loc_FFEE6760:\n"

                "BL      sub_FFEE711C\n"
                "B       loc_FFEE6784\n"
"loc_FFEE6768:\n"

                "BL      sub_FFEE7428\n"
                "B       loc_FFEE6784\n"
"loc_FFEE6770:\n"

                "BL      sub_FFEE75F0\n"
                "B       loc_FFEE6784\n"
"loc_FFEE6778:\n"

                "BL      sub_FFEE7340\n"
                "B       loc_FFEE6784\n"
"loc_FFEE6780:\n"

                "BL      sub_FFEE716C\n"
"loc_FFEE6784:\n"

                "LDR     R1, [SP]\n"
"loc_FFEE6788:\n"

                "LDR     R3, =0x9BA10\n"
                "MOV     R2, #0\n"
                "STR     R2, [R1]\n"
                "LDR     R0, [R3]\n"
                "BL      sub_FFE82E14\n"
"loc_FFEE679C:\n"
                "LDR     R3, =0x9BA0C\n"
                "MOV     R1, R4\n"
                "LDR     R0, [R3]\n"
                "MOV     R2, #0\n"
                "BL      sub_FFE829FC\n"
                "LDR     R0, [SP]\n"
                "LDR     R12, [R0]\n"
                "CMP     R12, #0xC\n"
                "MOV     R1, R0\n"
                "BNE     loc_FFEE66F8\n"
                "LDR     R3, =0x9BA08\n"
                "LDR     R0, [R3]\n"
                "BL      sub_FFE837CC\n"
                "BL      sub_FFE83FC0\n"
                "ADD     SP, SP, #4\n"
                "LDMFD   SP!, {R4,PC}\n"
 );
}



void __attribute__((naked,noinline)) sub_FFEE6E70_my(){
 asm volatile(
                "STMFD   SP!, {R4-R11,LR}\n"
                "LDR     R5, =0x9BAFC\n"
                "SUB     SP, SP, #0x3C\n"
                "LDR     R3, [R5]\n"
                "CMP     R3, #3\n"
                "MOV     R4, R0\n"
                "MOVEQ   R3, #4\n"
                "STREQ   R3, [R5]\n"
                "LDR     R3, =0x9BBBC\n"
                "MOV     LR, PC\n"
                "LDR     PC, [R3]\n"
                "LDR     R2, [R5]\n"
                "CMP     R2, #4\n"
                "BNE     loc_FFEE7048\n"
                "ADD     R0, SP, #0x38\n"
                "ADD     R1, SP, #0x34\n"
                "ADD     R2, SP, #0x30\n"
                "ADD     R3, SP, #0x2c\n"
                "BL      sub_FFEE81A8_my\n" //--------->
                "CMP     R0, #0\n"
                "BNE     loc_FFEE6EEC\n"
                "LDR     R3, =0x9BAE8\n"
                "LDR     R2, [R3]\n"
                "CMP     R2, #1\n"
                "BNE     loc_FFEE6F00\n"
                "LDR     R2, =0x9BB40\n"
                "LDR     R1, =0x9BB14\n"
                "LDR     R12, [R2]\n"
                "LDR     R3, [R1]\n"
                "CMP     R12, R3\n"
                "BCC     loc_FFEE6F00\n"
"loc_FFEE6EEC:\n"
                "BL      sub_FFEE7094\n"
                "BL      sub_FFEE7294\n"
                "MOV     R3, #5\n"
                "STR     R3, [R5]\n"
                "B       loc_FFEE7048\n"
"loc_FFEE6F00:\n"
                "LDR     R1, =0x9BB48\n"
                "LDR     R10, [R1]\n"
                "LDR     R1, =0x9BB54\n"
                "LDR     R2, [R4,#0xC]\n"
                "LDMIB   R4, {R0,R9}\n"
                "ADD     R4, SP, #0x24\n"
                "LDR     R8, [R1]\n"
                "LDR     R5, [SP,#0x34]\n"
                "LDR     R6, [SP,#0x30]\n"
                "LDR     R7, [SP,#0x2c]\n"
                "STR     R4, [SP,#0x20]\n"
                "LDR     R4, =0x9BAEC\n"
                "ADD     R12, SP, #0x28\n"
                "MOV     LR, #0\n"
                "MOV     R11, #1\n"
                "LDR     R3, [SP,#0x38]\n"
                "STMEA   SP, {R5-R7,R12}\n"
                "STR     R10, [SP,#0x10]\n"
                "STR     R8, [SP,#0x14]\n"
                "STR     LR, [SP,#0x18]\n"
                "MOV     R1, R9\n"
                "STR     R11, [R4]\n"
                "STR     R9, [SP,#0x1c]\n"
                "BL      sub_FFEEA150\n"
                "LDR     R3, =0x9BA00\n"
                "MOV     R1, #0x3E8\n"
                "LDR     R0, [R3]\n"
                "BL      sub_FFE835C4\n"
                "CMP     R0, #9\n"
                "BNE     loc_FFEE6F88\n"
                "BL      sub_FFEE89B8\n"
                "LDR     R3, =0x9BAFC\n"
                "LDR     R0, =0xFFEE6E58\n"
                "B       loc_FFEE6FA0\n"
"loc_FFEE6F88:\n"
                "LDR     R5, [SP,#0x24]\n"
                "CMP     R5, #0\n"
                "BEQ     loc_FFEE6FAC\n"
                "BL      sub_FFEE89B8\n"
                "LDR     R3, =0x9BAFC\n"
                "LDR     R0, =0xFFEE6E64\n"
"loc_FFEE6FA0:\n"
                "STR     R11, [R3]\n"
                "BL      sub_FFEA5060\n"
                "B       loc_FFEE7048\n"
"loc_FFEE6FAC:\n"
                "BL      sub_FFEEA2C0\n"
                "LDR     R0, [SP,#0x38]\n"
                "LDR     R1, [SP,#0x28]\n"
                "BL      sub_FFEE86DC\n"
                "LDR     R4, =0x9BB40\n"
                "LDR     R3, [R4]\n"
                "ADD     R3, R3, #1\n"
                "LDR     R0, [SP,#0x28]\n"
                "LDR     R1, =0x9BB54\n"
                "STR     R3, [R4]\n"
                "MOV     R2, R5\n"
                "BL      sub_FFE617C8_my\n"		//------->
                "LDR     R3, =0x9BB60\n"
                "LDR     R1, [R4]\n"
                "LDR     R2, [R3]\n"
                "LDR     R12, =0x9BB5C\n"
                "MUL     R0, R2, R1\n"
                "LDR     R1, [R12]\n"
                "BL      sub_FFCBC550\n"
                "LDR     R7, =0x9BB58\n"
                "LDR     R3, [R7]\n"
                "MOV     R4, R0\n"
                "CMP     R3, R4\n"
                "BNE     loc_FFEE7020\n"
                "LDR     R6, =0x9BAF0\n"
                "LDR     R3, [R6]\n"
                "CMP     R3, #1\n"
                "BNE     loc_FFEE703C\n"
                "B       loc_FFEE7024\n"
"loc_FFEE7020:\n"
                "LDR     R6, =0x9BAF0\n"
"loc_FFEE7024:\n"
                "LDR     R3, =0x9BBA0\n"
                "MOV     R0, R4\n"
                "MOV     LR, PC\n"
                "LDR     PC, [R3]\n"
                "STR     R5, [R6]\n"
                "STR     R4, [R7]\n"
"loc_FFEE703C:\n"
                "LDR     R2, =0x9BAEC\n"
                "MOV     R3, #0\n"
                "STR     R3, [R2]\n"
"loc_FFEE7048:\n"
                "ADD     SP, SP, #0x3C\n"
                "LDMFD   SP!, {R4-R11,PC}\n"
);
}


void __attribute__((naked,noinline)) sub_FFEE81A8_my(){
 asm volatile(
                "STMFD   SP!, {R4-R11,LR}\n"
                "LDR     R5, =0x9BE4C\n"
                "SUB     SP, SP, #0x14\n"
                "LDR     LR, [R5]\n"
                "LDR     R12, =0x9BE64\n"
                "ADD     LR, LR, #1\n"
                "LDR     R4, [R12]\n"
                "STR     LR, [R5]\n"
                "LDR     R12, =0x9BEE4\n"
                "STR     R0, [SP,#0x10]\n"
                "STR     R1, [SP,#0xC]\n"
                "STR     R2, [SP,#8]\n"
                "STR     R3, [SP,#4]\n"
                "CMP     LR, R4\n"
                "LDR     R11, [R12]\n"
                "MOVHI   R0, #0x80000001\n"
                "BHI     loc_FFEE8690\n"
                "LDR     R3, =0x9BEC8\n"
                "MOV     R0, LR\n"
                "LDR     R1, [R3]\n"
                "BL      sub_FFCBC5E8\n"
                "CMP     R0, #1\n"
                "BNE     loc_FFEE83C8\n"
                "LDR     R0, =0x9BEEC\n"
                "LDR     R1, =0x9BE38\n"
                "LDR     R3, [R0]\n"
                "LDR     R2, [R1]\n"
                "CMP     R3, R2\n"
                "LDREQ   R3, =0x9BEE8\n"
                "LDREQ   R5, [R3]\n"
                "MOVNE   R5, R2\n"
                "LDR     R3, =0x9BE4C\n"
                "LDR     R2, =0x9BEC8\n"
                "LDR     R0, [R3]\n"
                "LDR     R1, [R2]\n"
                "BL      sub_FFCBC550\n"
                "LDR     R3, =0x9BE40\n"
                "ADD     R0, R0, #1\n"
                "AND     R0, R0, #1\n"
                "STR     R5, [R3,R0,LSL#2]\n"
                "LDR     R3, =0x9BE34\n"
                "LDR     R2, [R3]\n"
                "CMP     R5, R2\n"
                "BHI     loc_FFEE8278\n"
                "LDR     R4, =0x9BE84\n"
                "LDR     R3, [R4]\n"
                "ADD     R3, R5, R3\n"
                "ADD     R3, R3, #8\n"
                "CMP     R2, R3\n"
                "BCS     loc_FFEE827C\n"
"loc_FFEE8270:\n"
                "MOV     R0, #0x80000003\n"
                "B       loc_FFEE8690\n"
"loc_FFEE8278:\n"
                "LDR     R4, =0x9BE84\n"
"loc_FFEE827C:\n"
                "LDR     R3, [R4]\n"
                "LDR     R2, =0x9BEEC\n"
                "ADD     R1, R5, R3\n"
                "LDR     R3, [R2]\n"
                "ADD     R2, R1, #8\n"
                "CMP     R2, R3\n"
                "BLS     loc_FFEE82C8\n"
                "LDR     R2, =0x9BEE8\n"
                "LDR     R0, =0x9BE34\n"
                "RSB     R3, R3, R1\n"
                "LDR     R1, [R2]\n"
                "ADD     R3, R3, #8\n"
                "LDR     R2, [R0]\n"
                "ADD     R1, R1, R3\n"
                "CMP     R2, R1\n"
                "BCC     loc_FFEE8270\n"
                "LDR     R3, =0x9BE38\n"
                "STR     R1, [R3]\n"
                "B       loc_FFEE82D0\n"
"loc_FFEE82C8:\n"
                "LDR     R3, =0x9BE38\n"
                "STR     R2, [R3]\n"
"loc_FFEE82D0:\n"
                "LDR     R3, [R4]\n"
                "LDR     R12, =0x9BE98\n"
                "ADD     R3, R3, #0x18\n"
                "LDR     R2, [R12,#4]\n"
                "MOV     R0, R3\n"
                "MOV     R1, #0\n"
                "CMP     R1, R2\n"
                "BHI     loc_FFEE8514\n"
                "BNE     loc_FFEE8300\n"
                "LDR     R3, [R12]\n"
                "CMP     R0, R3\n"
                "BHI     loc_FFEE8514\n"
"loc_FFEE8300:\n"
                "LDR     R4, [R4]\n"
                "LDR     LR, =0x9BEA0\n"
                "STR     R4, [SP]\n"
                "LDR     R12, =0x9BE98\n"
                "LDR     R3, =0x9BE4C\n"
                "LDMIA   LR, {R7,R8}\n"
                "LDMIA   R12, {R5,R6}\n"
                "LDR     R10, [R3]\n"
                "LDR     R2, =0x9BEC8\n"
                "MOV     R3, R4\n"
                "MOV     R4, #0\n"
                "ADDS    R7, R7, R3\n"
                "ADC     R8, R8, R4\n"
                "LDR     R9, [R2]\n"
                "SUBS    R5, R5, R3\n"
                "SBC     R6, R6, R4\n"
                "MVN     R2, #0\n"
                "MVN     R1, #0x17\n"
                "ADDS    R5, R5, R1\n"
                "MOV     R4, #0\n"
                "MOV     R3, #0x18\n"
                "ADC     R6, R6, R2\n"
                "ADDS    R7, R7, R3\n"
                "ADC     R8, R8, R4\n"
                "STMIA   R12, {R5,R6}\n"
                "SUB     R0, R10, #1\n"
                "MOV     R1, R9\n"
                "STMIA   LR, {R7,R8}\n"
                "BL      sub_FFCBC550\n"
                "CMP     R10, #1\n"
                "MLA     R0, R9, R0, R0\n"
                "BEQ     loc_FFEE83C8\n"
                "SUB     R3, R0, #1\n"
                "MOV     R3, R3,LSL#4\n"
                "ADD     R4, R11, #0x10\n"
                "ADD     R5, R11, #0x14\n"
                "LDR     R1, [R5,R3]\n"
                "LDR     R2, [R4,R3]\n"
                "LDR     LR, =0x62773130\n"
                "ADD     R2, R2, R1\n"
                "MOV     R3, R0,LSL#4\n"
                "ADD     R2, R2, #8\n"
                "MOV     R0, #0\n"
                "ADD     R12, R11, #0xC\n"
                "ADD     R1, R11, #8\n"
                "STR     LR, [R1,R3]\n"
                "STR     R0, [R12,R3]\n"
                "STR     R2, [R4,R3]\n"
                "LDR     R0, [SP]\n"
                "STR     R0, [R5,R3]\n"
"loc_FFEE83C8:\n"
                "LDR     R2, =0x9BE38\n"
                "LDR     R3, =0x9BEEC\n"
                "LDR     R1, [R2]\n"
                "LDR     R0, [R3]\n"
                "ADD     R3, R1, #9\n"
                "CMP     R3, R0\n"
                "BLS     loc_FFEE8404\n"
                "LDR     R2, =0x9BEE8\n"
                "LDR     R3, [R2]\n"
                "ADD     R3, R3, R1\n"
                "RSB     R3, R0, R3\n"
                "LDR     R0, [SP,#0x10]\n"
                "ADD     R3, R3, #8\n"
                "STR     R3, [R0]\n"
                "B       loc_FFEE8410\n"
"loc_FFEE8404:\n"
                "ADD     R3, R1, #8\n"
                "LDR     R1, [SP,#0x10]\n"
                "STR     R3, [R1]\n"
"loc_FFEE8410:\n"
                "LDR     R2, [SP,#0x10]\n"
                "LDR     R1, =0x9BE94\n"
                "LDR     R3, =0x9BEEC\n"
                "LDR     R12, [R2]\n"
                "LDR     R2, [R1]\n"
                "LDR     R0, [R3]\n"
                "ADD     R3, R12, R2\n"
                "CMP     R3, R0\n"
                "BLS     loc_FFEE8464\n"
                "LDR     R2, [SP,#0xC]\n"
                "RSB     R0, R12, R0\n"
                "STR     R0, [R2]\n"
                "LDR     R2, =0x9BEE8\n"
                "LDR     R3, [R1]\n"
                "LDR     R1, [R2]\n"
                "RSB     R3, R0, R3\n"
                "LDR     R0, [SP,#8]\n"
                "STR     R1, [R0]\n"
                "LDR     R1, [SP,#4]\n"
                "STR     R3, [R1]\n"
                "B       loc_FFEE8480\n"
"loc_FFEE8464:\n"
                "LDR     R0, [SP,#0xC]\n"
                "STR     R2, [R0]\n"
                "LDR     R1, [SP,#04]\n"
                "MOV     R3, #0\n"
                "STR     R3, [R1]\n"
                "LDR     R2, [SP,#8]\n"
                "STR     R3, [R2]\n"
"loc_FFEE8480:\n"
                "LDR     R0, =0x9BE38\n"
                "LDR     R1, =0x9BE34\n"
                "LDR     R3, [R0]\n"
                "LDR     R2, [R1]\n"
                "CMP     R3, R2\n"
                "BHI     loc_FFEE84AC\n"
                "LDR     R0, [SP,#0xC]\n"
                "LDR     R3, [R0]\n"
                "ADD     R3, R12, R3\n"
                "CMP     R2, R3\n"
                "BCC     loc_FFEE8270\n"
"loc_FFEE84AC:\n"
                "LDR     R1, [SP,#8]\n"
                "LDR     R2, [R1]\n"
                "CMP     R2, #0\n"
                "BEQ     loc_FFEE84E0\n"
                "LDR     R3, =0x9BE34\n"
                "LDR     R1, [R3]\n"
                "CMP     R2, R1\n"
                "BHI     loc_FFEE84E0\n"
                "LDR     R0, [SP,#4]\n"
                "LDR     R3, [R0]\n"
                "ADD     R3, R2, R3\n"
                "CMP     R1, R3\n"
                "BCC     loc_FFEE8270\n"
"loc_FFEE84E0:\n"
                "LDR     R3, =0x9BE94\n"
                "LDR     R0, =0x9BE98\n"
                "LDR     R2, [R3]\n"
                "LDR     R3, [R0,#4]\n"
                "ADD     R2, R2, #0x18\n"
                "MOV     R1, R2\n"
                "MOV     R2, #0\n"
                "CMP     R2, R3\n"
                "BHI     loc_FFEE8514\n"
                "BNE     loc_FFEE851C\n"
                "LDR     R3, [R0]\n"
                "CMP     R1, R3\n"
                "BLS     loc_FFEE851C\n"
"loc_FFEE8514:\n"
                "MOV     R0, #0x80000005\n"
                "B       loc_FFEE8690\n"
"loc_FFEE851C:\n"
                "LDR     R1, =0x9BE7C\n"
                "LDR     R0, =0x9BEC8\n"
                "LDR     R3, [R1]\n"
                "LDR     R2, [R0]\n"
                "ADD     R3, R3, R2,LSL#4\n"
                "ADD     R3, R3, R3,LSL#2\n"
                "LDR     R12, =0x9BE98\n"
                "MOV     R3, R3,LSL#1\n"
                "ADD     R3, R3, #0xA0\n"
                "LDR     R2, [R12,#4]\n"
                "MOV     R0, R3\n"
                "MOV     R1, #0\n"
                "CMP     R1, R2\n"
                "BHI     loc_FFEE8564\n"
                "BNE     loc_FFEE8588\n"
                "LDR     R3, [R12]\n"
                "CMP     R0, R3\n"
                "BLS     loc_FFEE8588\n"
"loc_FFEE8564:\n"
                "LDR     R4, =0x9BEB0\n"
                "LDR     R1, [R4]\n"
                "CMP     R1, #0\n"
                "BNE     loc_FFEE8588\n"
                "MOV     R0, #0x3140\n"
                "BL      sub_FFEA0960\n"
                "MOV     R3, #1\n"
                "STR     R3, [R4]\n"
"loc_FFEE8588:\n"
                "LDR     R1, =0x9BE7C\n"
                "LDR     R0, =0x9BEC8\n"
                "LDR     R2, [R1]\n"
                "LDR     R3, [R0]\n"
                "LDR     R0, =0x9BEA0\n"
                "ADD     R2, R2, R3,LSL#4\n"
                "MVN     R3, #0x9F\n"
                "ADD     R2, R2, R2,LSL#2\n"
                "ADD     R3, R3, #0x40000000\n"
                "SUB     R3, R3, R2,LSL#1\n"
                "LDR     R1, [R0,#4]\n"
                "MOV     R4, R3\n"
                "MOV     R5, #0\n"
                "CMP     R1, R5\n"
                "BHI     loc_FFEE85D4\n"
                "BNE     loc_FFEE85F8\n"
                "LDR     R3, [R0]\n"
                "CMP     R3, R4\n"
                "BLS     loc_FFEE85F8\n"
"loc_FFEE85D4:\n"
                "LDR     R4, =0x9BEB0\n"
                "LDR     R1, [R4]\n"
                "CMP     R1, #0\n"
                "BNE     loc_FFEE85F8\n"
                "MOV     R0, #0x3140\n"
                "BL      sub_FFEA0960\n"
                "MOV     R3, #1\n"
                "STR     R3, [R4]\n"
"loc_FFEE85F8:\n"
                "LDR     R3, =0x9BEC8\n"
                "LDR     R0, =0x9BE64\n"
                "LDR     R2, [R3]\n"
                "LDR     R12, =0x9BE4C\n"
                "LDR     R1, [R0]\n"
                "ADD     R3, R2, R2,LSL#2\n"
                "ADD     R2, R2, R3,LSL#1\n"
                "LDR     R0, [R12]\n"
                "RSB     R1, R2, R1\n"
                "CMP     R0, R1\n"
                "BLS     loc_FFEE8648\n"
                "LDR     R4, =0x9BEB0\n"
                "LDR     R1, [R4]\n"
                "CMP     R1, #0\n"
                "BNE     loc_FFEE8648\n"
                "MOV     R0, #0x3140\n"
                "BL      sub_FFEA0960\n"
                "MOV     R3, #1\n"
                "STR     R3, [R4]\n"
"loc_FFEE8648:\n"
                "LDR     R3, =0x9BEA0\n"
                "LDR     R12, =0x9BE94\n"
                "LDMIA   R3, {R1,R2}\n"
                "LDR     R0, [R12]\n"
                "MOV     R4, #0\n"
                "MOV     R3, #0x18\n"
                "ADDS    R1, R1, R0\n"
                "ADC     R2, R2, #0\n"
                "ADDS    R1, R1, R3\n"
                "ADC     R2, R2, R4\n"
                "CMP     R2, #0\n"
                "BHI     loc_FFEE8684\n"
                "BNE     loc_FFEE868C\n"
                "CMP     R1, #0x40000000\n"
       //       "BLS     loc_FFEE868C\n"		//-
       
       					"B       loc_FFEE868C\n"		//+
       					
"loc_FFEE8684:\n"
                "MOV     R0, #0x80000007\n"
                "B       loc_FFEE8690\n"
"loc_FFEE868C:\n"

                "MOV     R0, #0\n"
"loc_FFEE8690:\n"

                "ADD     SP, SP, #0x14\n"
                "LDMFD   SP!, {R4-R11,PC}\n"
 );
}




void __attribute__((naked,noinline)) sub_FFE617C8_my(){
 asm volatile(
                "CMP     R2, #1\n"
                "STMFD   SP!, {R4-R7,LR}\n"
                "MOV     R6, R0\n"
                "MOV     R7, R1\n"
                "MOVEQ   R3, #0x79\n"
                "STREQ   R3, [R7]\n"
                "LDMEQFD SP!, {R4-R7,PC}\n"
                "LDR     R12, =0x77E1C\n"
                "LDR     R0, [R12]\n"
                "LDR     R3, =0x77E24\n"
                "CMP     R0, #0\n"
                "LDR     R1, [R3]\n"
                "BEQ     loc_FFE61810\n"
                "LDR     R2, =0x77E28\n"
                "LDR     R3, [R2]\n"
                "CMP     R3, #1\n"
                "BNE     loc_FFE61824\n"
                "B       loc_FFE61814\n"
"loc_FFE61810:\n"
                "LDR     R2, =0x77E28\n"
"loc_FFE61814:\n"
                "MOV     R3, #0\n"
                "STR     R3, [R2]\n"
                "STR     R6, [R12]\n"
                "B       loc_FFE618DC\n"
"loc_FFE61824:\n"
                "LDR     R2, =0x77E20\n"
                "LDR     R3, [R2]\n"
                "LDR     R5, =table1\n"		// +
                "ADD     R3, R3, R3,LSL#1\n"
                "MOV     LR, R3,LSL#2\n"
                "LDR     R2, [R5,LR]\n"
                "LDR     R4, =table2\n"		// +
                "RSB     R12, R2, R0\n"
                "LDR     R3, [R4,LR]\n"
                "CMP     R12, #0\n"
                "RSB     R0, R3, R0\n"
                "BLE     loc_FFE61888\n"
                "ADD     R3, R5, #4\n"
                "LDR     R2, [R3,LR]\n"
                "CMP     R2, R12\n"
                "ADDGE   R1, R1, #1\n"
                "BGE     loc_FFE6187C\n"
                "ADD     R3, R5, #8\n"
                "LDR     R2, [R3,LR]\n"
                "CMP     R2, R12\n"
                "ADDGE   R1, R1, #2\n"
                "ADDLT   R1, R1, #3\n"
"loc_FFE6187C:\n"
        //      "CMP     R1, #0xE\n"		// -
        //      "MOVGE   R1, #0xE\n"		// -
                "CMP     R1, #0x1A\n"  //+
                "MOVGE   R1, #0x1A\n"  //+        
        
                "B       loc_FFE618C0\n"
"loc_FFE61888:\n"
                "CMP     R0, #0\n"
                "BGE     loc_FFE618C0\n"
                "ADD     R3, R4, #4\n"
                "LDR     R2, [R3,LR]\n"
                "CMP     R2, R0\n"
                "SUBLE   R1, R1, #1\n"
                "BLE     loc_FFE618B8\n"
                "ADD     R3, R4, #8\n"
                "LDR     R2, [R3,LR]\n"
                "CMP     R2, R0\n"
                "SUBLE   R1, R1, #2\n"
                "SUBGT   R1, R1, #3\n"
"loc_FFE618B8:\n"
                "CMP     R1, #0\n"
                "MOVLT   R1, #0\n"
"loc_FFE618C0:\n"

                "LDR     R0, =0x77E24\n"
                "LDR     R3, [R0]\n"
                "CMP     R1, R3\n"
                "LDRNE   R2, =0x77E28\n"
                "MOVNE   R3, #1\n"
                "STRNE   R1, [R0]\n"
                "STRNE   R3, [R2]\n"
"loc_FFE618DC:\n"
                "LDR     R3, =0x77E24\n"
                "LDR     R2, =CompressionRateTable\n"
                "LDR     R1, [R3]\n"
                "LDR     R0, =0x77E1C\n"
                "LDR     R3, [R2,R1,LSL#2]\n"
                
                "LDR     R1, =video_mode\n"      // +
                "LDR     R1, [R1]\n"             // +
                "LDR     R1, [R1]\n"             // +
                "CMP     R1, #1\n"               // +
                "LDREQ   R1, =video_quality\n"   // +     
                "LDREQ   R1, [R1]\n"             // +     
                "LDREQ   R3, [R1]\n"             // +     
                
                "STR     R6, [R0]\n"
                "STR     R3, [R7]\n"
                "BL      mute_on_zoom\n"     // +
                "LDMFD   SP!, {R4-R7,PC}\n"
 );
}

